package com.cxf.windex.biz;

import com.cxf.windex.base.biz.BaseBiz;
import com.cxf.windex.base.common.ServiceException;
import com.cxf.windex.base.constant.UserConstant;
import com.cxf.windex.entity.BOrdersTask;
import com.cxf.windex.entity.PositionTown;
import com.cxf.windex.mapper.PositionTownMapper;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.Date;
import java.util.List;

/**
 * 乡镇Biz
 *
 * @author chenxf
 * @version 1.0
 * @date 2018-12-05 11:11
 **/
@Service
public class PositionTownBiz  extends BaseBiz<PositionTownMapper, PositionTown> {
    /**
     * 查询乡镇列表
     * @param countyId 区县ID
     * @return
     */
    public List<PositionTown> list( String countyId) {
        if(StringUtils.isBlank(countyId)){
            throw new ServiceException("区县ID不能为空");
        }
        Example example = new Example(PositionTown.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("countyId",countyId+ UserConstant.COUNTY_CODE);
        example.setOrderByClause(" id asc " );
        return selectByExample(example);
    }
}
